{# Macro for creating navigation links #}
{% macro render_navigation(pagination, endpoint) %}
  <div>
    {% for page in pagination.iter_pages() %}
      {% if page %}
        {% if page != pagination.page %}
          <a href="{{ url_for(endpoint, page=page) }}">{{ page }}</a>
        {% else %}
          <strong>{{ page }}</strong>
        {% endif %}
      {% else %}
        <span>nothing to show</span>
      {% endif %}
    {% endfor %}
  </div>
{% endmacro %}

{# Example macro for rendering fields #}
{% macro render_field(field) %}
  <div class="form_field">
    {% if field.errors %}
      {% set css_class = 'has_error ' + kwargs.pop('class', '') %}
      {{ field.label }}{{ field(class=css_class, **kwargs) }}{% if field.flags.required %}*{% endif %}
      <ul class="errors">{% for error in field.errors %}
        <li>{{ error|e }}</li>{% endfor %}</ul>
    {% else %}
      {{ field.label }}{{ field(**kwargs) }}{% if field.flags.required %}*{% endif %}
    {% endif %}
  </div>
{% endmacro %}
